<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core">
	

<h:head>
	<title>祖龙娱乐  - BI系统</title>
	<link href="../../css/component.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="../../js/highcharts.js"></script>
	<script type="text/javascript" src="../../js/drawChart.js"></script>
</h:head>

<h:body>
	<ui:param name="bean" value="#{platformAndChannelRealTimeAction}" />
	
	<span class="pagetitle">实时数据 —— CPS概况</span>
	<p:separator />
	
	<!-- 右侧页面顶部查询部分 -->
	<h:form id="fsearch">
		<p:poll interval="20" listener="#{bean.search()}" update=":dform" />
	
		<p:growl id="growl" showDetail="true" sticky="true" />
		<h:outputLabel value="查看日期：" />
        <p:calendar value="#{bean.lookDate}" mode="popup" pattern="yyyy-MM-dd" />
        <h:outputLabel value="（只能查看最近7天的数据）"  rendered="false"/>
		&#160;&#160;&#160;
		
        <p:commandButton value="查询" action="#{bean.search()}" update=":data" ajax="false" />
         <br />
		<h:outputLabel style="font-size:10px" value="数据更新频率为1分钟 ，#{bean.lastUpdateTimeStr}，下表实时数据为0点截止更新时间点内数据汇总" />
	</h:form>
	<br />

	<!-- 数据展示部分，包含表格和图表 -->
	<h:form id="dform">
		<div class="data" id="data">
			<p:panel id="panel1" header="分渠道数据" style="margin-bottom:10px;">
				<p:selectOneButton value="#{bean.selectedPlatform}">
		            <f:selectItem itemLabel="全部平台" itemValue="all" />
	            	<f:selectItem itemLabel="ios" itemValue="2" />
	            	<f:selectItem itemLabel="ios越狱" itemValue="1" />
	            	<f:selectItem itemLabel="安卓" itemValue="3" />
	            	<p:ajax update="dlist1" listener="#{bean.selectPlatform}" />
	        	</p:selectOneButton>

                <p:dataTable id="dlist1" var="l" value="#{bean.retlist}" scrollable="true" resizableColumns="true" paginator="true" paginatorPosition="bottom" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} {Exporters}" rowsPerPageTemplate="15,30" rows="15" style="text-align:center;">
                    <f:facet name="{Exporters}">
                        <h:commandLink styleClass="exporter">
                            <p:graphicImage url="/resources/images/excel.png" height="25px" />
                            <p:dataExporter type="xls" target="dlist1" fileName="cps-#{pageHelper.getNewDateDetailStr()}" />
                        </h:commandLink>
                    </f:facet>

                    <p:column headerText="渠道名称" styleClass="column grcnewUser" sortBy="#{pageHelper.getChannelNameById(l.channelid)}">
						<h:outputLabel value="#{pageHelper.getChannelNameById(l.channelid)}" />
					</p:column>
                    <p:column headerText="激活设备" styleClass="column grcnewUser" sortBy="#{l.activate}">
                        <h:outputLabel value="#{l.activate}" />
                    </p:column>
					<p:column headerText="新增帐号" styleClass="column grcnewUser" sortBy="#{l.newUser}">
						<h:outputLabel value="#{l.newUser}" />
					</p:column>
					<p:column headerText="活跃帐号" styleClass="column grcnewUser" sortBy="#{l.activeUser}">
						<h:outputLabel value="#{l.activeUser}" />
					</p:column>
					<p:column headerText="付费帐号" styleClass="column grcnewUser" sortBy="#{l.payUser}">
						<h:outputLabel value="#{l.payUser}" />
					</p:column>
					<p:column headerText="付费金额#{pageHelper.getMoneyType()}" styleClass="column grcnewUser" sortBy="#{l.pay}">
						<h:outputLabel value="#{l.pay}" />
					</p:column>
					<p:column headerText="活跃付费率" styleClass="column grcnewUser" sortBy="#{l.payUserInActiveRadio}">
						<h:outputLabel value="#{pageHelper.double2Percent(l.payUserInActiveRadio)}" />
					</p:column>
					<p:column headerText="付费ARPU#{pageHelper.getMoneyType()}" styleClass="column grcthe3Left" sortBy="#{l.payARPU}">
						<h:outputLabel value="#{l.payARPU}" />
					</p:column>
					<p:column headerText="活跃ARPU#{pageHelper.getMoneyType()}" styleClass="column grcthe3Left" sortBy="#{l.activeARPU}">
						<h:outputLabel value="#{l.activeARPU}" />
					</p:column>
					<p:column headerText="#{bean.getLeftDate(2)}-次日留存率" styleClass="column grcthe3Left" sortBy="#{l.the2LeftRadio}">
						<h:outputLabel value="#{pageHelper.double2Percent(l.the2LeftRadio)}" />
					</p:column>
					<p:column headerText="#{bean.getLeftDate(3)}-3日留存率" styleClass="column grcthe3Left" sortBy="#{l.the3LeftRadio}">
						<h:outputLabel value="#{pageHelper.double2Percent(l.the3LeftRadio)}" />
					</p:column>
					<p:column headerText="#{bean.getLeftDate(7)}-7日留存率" styleClass="column grcthe3Left" sortBy="#{l.the7LeftRadio}">
						<h:outputLabel value="#{pageHelper.double2Percent(l.the7LeftRadio)}" />
					</p:column>
				</p:dataTable>
			</p:panel>
		</div>
	</h:form>

	<!-- 页脚 -->
	<div class="footer"></div>
</h:body>
</html>